Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Union decisions #1492

Open
wants to merge 9 commits into
base: master
Choose a base branch
from

Conversation

Elfangor567
Copy link
Contributor

No description provided.

Elfangor567 and others added 8 commits August 1, 2022 20:33
- Base that does not yet work.
- Now works, but only if the union nation has cores in VIC2, and that isn't always true.
- Now based on state flags
- State Trigger decision added to show where states you need to conquer are
- IMPORTANT - Does not seem to initialize currently, and so is completely broken. Further investigation pending.
- It works!
- Added some missing shields
- Clang formatting
Ignore CultureGroup leader, is_overseas & unit entries
@Elfangor567 Elfangor567 requested a review from Idhrendur as a code owner August 6, 2022 00:32
src/HOI4World/Decisions/Decision.h Show resolved Hide resolved
src/HOI4World/Decisions/DecisionsInCategory.h Outdated Show resolved Hide resolved
@@ -39,6 +45,8 @@ class DecisionsInCategory: commonItems::parser
private:
std::string name = "";
std::vector<decision> theDecisions;
std::map<std::string, std::string> localisation;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Localisations should probably include all languages

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know how languages are handled in Vic->Hoi, but I can look into it.
I could output each individually perhaps? Not sure if you have a predefined LocBlock like in CK->EU anywhere

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yup, I am lost decisionLocalisations(std::move(decisionLocalisations)), customLocalisations(std::move(customLocalisations)),

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure anymore either. I know that some other objects (e.g. Dynasty names - House of...) have all the localisations set in the code. I won't be at the computer for couple of days to check how it works with decisions.

src/HOI4World/Decisions/UnionDecisions.cpp Outdated Show resolved Hide resolved
src/HOI4World/Decisions/UnionDecisions.cpp Outdated Show resolved Hide resolved
src/V2World/Provinces/Province.cpp Outdated Show resolved Hide resolved
- Begins to add support for foreign languages for Union Decisions
Comment on lines +623 to +631
Log(LogLevel::Debug) << "State: " << newState.getID();
for (const auto& popCulture: popCultureMap)
{
Log(LogLevel::Debug) << "\t\t\t" << popCulture.first << " Pops: " << popCulture.second
<< "\n\tPopulation: " << static_cast<double>(totalPopulation);
if (popCulture.second / static_cast<double>(totalPopulation) >= 0.25 &&
!newState.getMajorCultures().count(popCulture.first))
newState.addMajorCulture(popCulture.first);
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Make this conditional on debug being set to true in configuration. You can pass just the debug variable to this function instead of the whole config when doing so.

Comment on lines +64 to +65
if (!cultures.count(pop.getCulture()))
cultures.emplace(pop.getCulture());
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if (!cultures.count(pop.getCulture()))
cultures.emplace(pop.getCulture());
cultures.emplace(pop.getCulture());

Comment on lines +604 to +610
std::set<std::string> oneCulture = {culture};
if (!popCultureMap.count(culture))
popCultureMap.emplace(culture,
provincePopulation * vic2Province->second->getPercentageWithCultures(oneCulture));
else
popCultureMap.find(culture)->second +=
provincePopulation * vic2Province->second->getPercentageWithCultures(oneCulture);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
std::set<std::string> oneCulture = {culture};
if (!popCultureMap.count(culture))
popCultureMap.emplace(culture,
provincePopulation * vic2Province->second->getPercentageWithCultures(oneCulture));
else
popCultureMap.find(culture)->second +=
provincePopulation * vic2Province->second->getPercentageWithCultures(oneCulture);
if (auto [iterator, success] = popCultureMap.emplace(culture,
provincePopulation * vic2Province->second->getPercentageWithCultures(oneCulture)); !success)
{
iterator->second +=
provincePopulation * vic2Province->second->getPercentageWithCultures(oneCulture);
}

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fix for my inevitable syntax and formatting errors.

@Idhrendur
Copy link
Member

Make sure to add yourself to the credits in data/ReadMe.txt

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants